<%@page import="java.util.Calendar"%>
<%@page import="edu.hcmus.sow.utils.StringUtil"%>
<%@page import="javax.swing.text.DateFormatter"%>
<%@page import="java.text.DateFormat"%>
<%@page import="java.util.Date"%>
<%@page import="org.ocpsoft.pretty.time.PrettyTime"%>
<%@ page language="java" isELIgnored="false" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:directive.include file="/WEB-INF/sitemesh-decorators/include.jsp" />

<script>
function confirmDelete(delUrl) {
  if (confirm("Are you sure you want to delete?")) {
    document.location = delUrl;
  }
}
</script>
<table style="width: 100%; ">
	<c:forEach items="${workLogLists}" var="workLog" >
		<tr style="height: 30px;" >
			<c:set var="timeSpentDate" value="${workLog.loggedDate}"></c:set>
			<td  style="width: 70px; padding-left: 20px"><%=	StringUtil.convertCalendarToDate((Calendar)(pageContext.getAttribute("timeSpentDate")))%></td>
			<c:set var="timeSpentHours" value="${workLog.timeSpent}"></c:set>
			<td style="width: 50px; " > 
				<%=	StringUtil.convertTimeSpentToString((Integer)(pageContext.getAttribute("timeSpentHours"))) %>
			</td>
			<td style="width: 70px; padding-left: 2px;" >${workLog.user.username}</td>
			<td style="width: 110px; padding-left: 30px;" >${workLog.note}</td>
			<td style="width: 20px; " ><a href="javascript:confirmDelete('${pageContext.request.contextPath}/task/${taskID}/timespent/delete?id=${workLog.id}')" style="color: #1DAAC2; text-decoration: underline;">Delete</a></td>
		</tr>
	</c:forEach>
</table>
